package com.micro.Controller;
import com.api.domain.SysUser;
import com.micro.mapper.BankMapper;
import com.micro.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/bank")
public class Bank {
    @Autowired
    public BankMapper BankMapper;

    @Autowired
    public SysUserMapper sysUserMapper;
    @GetMapping("/list")
    public Object list() {
        return BankMapper.selectList(null);
    }
    @PostMapping("/update")
    @Transactional(rollbackFor = Exception.class)
    public void UpdateS(Long id,String name)
    {
        var user=sysUserMapper.selectById(id);
        user.setNickName(name);
        sysUserMapper.updateById(user);
    /*    var newUser=new SysUser();
        newUser.setNickName(name);
        sysUserMapper.insert(newUser);*/
    }
}
